<template>
	<view class="box w100">
		<view class="box-mian w100 flex-al flex-col">
			<view class="w100 flex-col title">
				<view>联系人</view>
				<view>{{username}} {{phone}}</view>
			</view>
			<view class="w100 flex-row content">
				<view class="flex-col">
					<view>
						乘车人数：
					</view>
					<view>
						发车时间：
					</view>
					<view>
						始发位置：
					</view>
					<view>
						到达位置：
					</view>
					<view>
						公交用途：
					</view>
				</view>
				<view class="flex-col">

					<view>
						{{peoplenumber}} 人
					</view>

					<view>
						{{choosetime}}
					</view>

					<view>
						{{stationup.name||stationup.address}}
					</view>

					<view>
						{{stationdown.name||stationdown.address}}
					</view>

					<view>
						{{yongtu}}
					</view>
				</view>
			</view>
			<view class="flex-col w100 footer">
				<view>定金：待确认</view>
				<view>全款金额：待确认</view>
			</view>
		</view>
		<view class="btn" hover-class="btn-hover" @click="xieyi">
			立即下单
		</view>
		<view class="xieyi w100 flex-row flex-al flex-jc" @click="xieyi">
			<image src="../../../static/imgs/tongyi.png"></image>
			<view>确认您阅读并同意《车辆定制服务协议》</view>
		</view>
		<uni-popup ref="alert1" type="center" :maskClick="true" :mask="true">
			<view class="alert-box flex-col flex-al">
				<view class="w100 flex-col flex-al">
					<image class="xieyi-img" src="/static/imgs/xieyi.png" mode=""></image>
				</view>
				<view class="xieyi-b flex-row flex-al flex-sb w100">
					<view @click="disagree">
						我不同意
					</view>
					<view @click="agree">
						同意并下单
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import HttpModule from "../../../module/httpModule.js"
	const httpModule = new HttpModule();
	import uniPopup from "@/components/uni-popup/uni-popup.vue"
	export default {
		data() {
			return {
				form: null,
				username: "参数错误",
				phone: "参数错误",
				stationup: {
					name: "参数错误"
				},
				stationdown: {
					name: "参数错误"
				},
				peoplenumber: "参数错误",
				choosetime: "参数错误",
				yongtu: "参数错误"
			}
		},
		components: {
			uniPopup
		},
		onLoad(e) {
			// {{username}}
			// {{phone}}
			// {{stationup}}
			// {{stationdown}}
			// {{peoplenumber}}
			// {{choosetime}}
			// {{yongtu}}
			this.form = e;
			this.username = e.username,
				this.phone = e.phone,
				this.stationup = JSON.parse(e.stationup),
				this.stationdown = JSON.parse(e.stationdown),
				this.peoplenumber = e.peoplenumber,
				this.choosetime = e.choosetime,
				this.yongtu = e.yongtu

		},
		methods: {
			disagree() {
				this.$refs.alert1.close()
			},
			async agree() {
				this.$refs.alert1.close();

				uni.showLoading({
					title: "提交中"

				})
				console.log(this.form)
				await httpModule.customBus(this.form);
				uni.hideLoading();
				uni.navigateTo({
					url: '/pages/serve/success/index',
				})
			},
			xieyi() {
				this.$refs.alert1.open()
			}
		}
	}
</script>

<style lang="less">
	.alert-box {
		width: 680rpx;
		background: #fff;
		border-radius: 8rpx;
		box-sizing: border-box;
		padding: 28rpx 50rpx;
	}

	.xieyi {
		font-size: 25rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: rgba(76, 76, 76, 1);

		image {
			width: 26rpx;
			height: 26rpx;
			margin-right: 5rpx;
		}
	}

	.xieyi-t {
		text-align: center;
		font-size: 30rpx;
		margin-top: 25rpx;
		font-weight: bold;
	}

	.xieyi-c {

		margin-top: 25rpx;
		font-size: 25rpx;
		color: rgba(117, 117, 117, 255);
		line-height: 35rpx;
	}

	.xieyi-b {
		view {
			width: 50%;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			margin-top: 25rpx;
			font-size: 28rpx;

			&:first-child {
				color: rgba(117, 117, 117, 255);
			}

			&:last-child {
				color: rgba(26, 184, 148, 1)
			}
		}

	}

	.btn {
		width: 685rpx;
		margin: 38rpx auto;
		height: 92rpx;
		background: rgba(26, 184, 148, 1);
		box-shadow: 0px 0rpx 22rpx 0rpx rgba(142, 242, 219, 1);
		border-radius: 10rpx;
		text-align: center;
		line-height: 92rpx;
		color: #fff;
		font-size: 30rpx;
		transition: all 200ms;
	}

	.btn-hover {
		transition: all 200ms;
		transform: scale(1.02);
	}

	.box {
		position: relative;
		background: rgba(244, 244, 244, 1);
		min-height: 100vh;
		padding-top: 10rpx;

		.box-mian {
			background: #fff;
			padding: 35rpx 60rpx;
			box-sizing: border-box;

			.title {
				view {
					&:first-child {
						font-size: 28rpx;
						font-weight: bolder;
						color: rgba(42, 42, 42, 1);
					}

					&:last-child {
						font-size: 25rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						olor: rgba(42, 42, 42, 1);
					}
				}
			}

			.content {
				padding: 18rpx 5rpx;
				border-top: 1rpx solid #f1f1f1;
				border-bottom: 1rpx solid #f1f1f1;
				margin-top: 27rpx;
				margin-bottom: 27rpx;

				view {
					&:first-child {
						font-size: 25rpx;
						color: rgba(135, 135, 135, 1);
						margin-right: 20rpx;

						view {
							margin: 2rpx 0;
						}
					}

					&:last-child {
						font-size: 25rpx;
						color: rgba(135, 135, 135, 1);
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;

						view {
							margin: 2rpx 0;
						}
					}
				}
			}

			.footer {
				view {
					&:first-child {
						font-size: 25rpx;
						color: rgba(193, 2, 2, 1);
					}

					&:last-child {
						font-size: 20rpx;
						margin-top: 5rpx;
						color: rgba(135, 135, 135, 1);
					}
				}
			}
		}
	}

	.xieyi-img {
		width: 646rpx;
		height: 905rpx;
	}
</style>
